/**
 * 入口文件
 * @author xiaoqiang <465633678@qq.com>
 * @created 2018/11/02 14:50:12
 */
const path = require('path')
const Koa = require('Koa')
const views = require('koa-views')
const static = require('koa-static')
const router = require('./router')
const app = new Koa()
/**
 * 模板中间件
 */
app.use(views(
  // 模板路径
  path.join(__dirname, './views'),
  {
    extension: 'html'
  }
))
/**
 * 静态资源中间件
 */
app.use(static(
  path.join(__dirname, './static')
))
/**
 * 路由中间件
 */
app.use(router.routes())
.use(router.allowedMethods())
/**
 * 监听端口9999
 */
app.listen(9999)
console.log('服务启动于9999端口')
